package com.qzct.mapper;

import com.mybatisflex.core.BaseMapper;
import com.qzct.entity.AttractionComments;
import com.qzct.entity.vo.CommentsVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 *  映射层。
 *
 * @author 闽闽
 * @since 2025-01-11
 */
public interface AttractionCommentsMapper extends BaseMapper<AttractionComments> {
    @Select("SELECT comment_content as 'commentContent',name,image FROM `tb_attraction_comments` INNER JOIN tb_user ON tb_attraction_comments.user_id = tb_user.uid WHERE attraction_id =#{id} and is_check = 1")
    ArrayList<CommentsVo> getAid(@Param("id") Serializable id);

    @Select("SELECT * FROM tb_attraction_comments")
    List<AttractionComments> getlist();

    @Update("update tb_attraction_comments set is_check = 1 where comments_id = #{id}")
    boolean updateIscheck(@Param("id") Serializable id);
}
